package com.nimlib;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import androidx.annotation.Nullable;

public class ImageViewBean implements Parcelable {
    private int position;
    private String uuid;
    private String url;
    private String PathForSave;
    private int height;
    private int width;
    public ImageViewBean(){

    }

    protected ImageViewBean(Parcel in) {
        position = in.readInt();
        uuid = in.readString();
        url = in.readString();
        PathForSave = in.readString();
        height = in.readInt();
        width = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(position);
        dest.writeString(uuid);
        dest.writeString(url);
        dest.writeString(PathForSave);
        dest.writeInt(height);
        dest.writeInt(width);
    }

    public static final Creator<ImageViewBean> CREATOR = new Creator<ImageViewBean>() {
        @Override
        public ImageViewBean createFromParcel(Parcel in) {
            return new ImageViewBean(in);
        }

        @Override
        public ImageViewBean[] newArray(int size) {
            return new ImageViewBean[size];
        }
    };

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPathForSave() {
        return PathForSave;
    }

    public void setPathForSave(String pathForSave) {
        PathForSave = pathForSave;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (obj instanceof ImageViewBean){
            ImageViewBean bean = (ImageViewBean) obj;
//            return bean.position == this.position && TextUtils.equals(bean.url, this.url)
//                    && TextUtils.equals(bean.uuid, this.uuid);
            return TextUtils.equals(bean.uuid, this.uuid);
        }
        return false;
    }

    @Override
    public int describeContents() {
        return 0;
    }
}
